<Window x:Class="Samurai.Client.Windows.RepositoryWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:Samurai.Client.Controls" 
        xmlns:Client="clr-namespace:Samurai.Client" 
        xmlns:Commands="clr-namespace:Samurai.Client.Commands"
        ResizeMode="NoResize"
        WindowStyle="ToolWindow"
        WindowStartupLocation="CenterScreen"
        Loaded="RepositoryTab_Loaded"
        Title="RepositoryWindow" MinHeight="300" MinWidth="300">
    <!--<Grid Background="Orange">-->
    <!--<TabControl>
            <TabItem x:Name="RepositoryTab" Header="Repositories" >-->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="35" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0" Text="Select the locations where you keep your movies." FontSize="32" FontWeight="Bold" />

        <StackPanel Grid.Row="1" Orientation="Horizontal">
            <Controls:SelectFolderDialog x:Name="SelectFolderDialog" HorizontalAlignment="Left" VerticalAlignment="Center" />
            <Button Content="Add" Style="{DynamicResource CommonButton}" Command="{Binding AddToRepositoryCommand}" CommandParameter="{Binding ElementName=SelectFolderDialog, Path=Text}" />
        </StackPanel>

        <DataGrid x:Name="dg" Grid.Row="2" ItemsSource="{Binding Repositories}" AutoGenerateColumns="False" >
            <DataGrid.Columns>
                <DataGridTemplateColumn MinWidth="100" Header="Location" Width="SizeToCells" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Location}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn MinWidth="100" Header="Action" Width="SizeToCells" IsReadOnly="True">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Style="{DynamicResource LinkButton}"
                            Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}, Path=DataContext.DeleteFromRepositoryCommand}"
                            CommandParameter="{Binding}"
                            Content="X" ToolTip="Click to delete repository">
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

            </DataGrid.Columns>
        </DataGrid>

    </Grid>
    <!--</TabItem>
        </TabControl>-->
    <!--</Grid>-->
</Window>
